home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 23
/
Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso
/
Aminet
/
dev
/
src
/
CdBS_KQSrc0_3.lha
/
KaliosysQuantrum
/
Gui.s
< prev
next >
Wrap
Text File
|
1997-11-05
|
73KB
|
3,363 lines
*
* CdBSian Obviously Universal & Interactive Nonsense (COUIN)
* (Absurdité CdBSienne Manifestement Universelle et Interactive)
* ©1997, CdBS Software (MORB)
* Gui routines
* $Id: Gui.s 0.58 1997/11/05 18:48:03 MORB Exp MORB $
*
;fs "_InitGui"
_GuiBpMem:
ds.l 1
_GuiSelMem:
ds.l 1
_GuiBitmap:
ds.l 1
_GuiSelBitmap:
ds.l 1
_InitGui:
lea _GuiBpPtrs,a0
move.l _GuiBitmap(pc),d0
move.w #bplpt,d1
moveq #NbGuiPlanes-1,d2
.Loop:
swap d0
move.w d1,(a0)+
move.w d0,(a0)+
addq.w #2,d1
move.w d1,(a0)+
swap d0
move.w d0,(a0)+
addq.w #2,d1
add.l #GuiBufferWidth,d0
dbf d2,.Loop
lea _GuiSelBpPtrs,a0
move.l _GuiSelBitmap(pc),d0
move.l d0,$8f00000
move.w #bplpt,d1
moveq #NbPlanes-1,d2
.Loop2:
swap d0
move.w d1,(a0)+
move.w d0,(a0)+
addq.w #2,d1
move.w d1,(a0)+
swap d0
move.w d0,(a0)+
addq.w #2,d1
add.l #GuiSelBufferWidth,d0
dbf d2,.Loop2
rts
;fe
;fs "Gui copper table"
CopLayer4:
dc.l 0,0
GuiP:
dc.w $29+240,CET_BREAK
dc.l _GuiCList
dc.l _GuiCopTable
_GuiCopTable:
dc.l GuiNml
_GuiL1Ptr:
dc.l CopEnd,-1
GuiLayer1:
dc.l 0,0
GuiSelP:
dc.w $29+240,CET_BREAK
dc.l _GuiSelCList
dc.l _GuiSelCopTable
_GuiSelCopTable:
dc.l GuiSelNml
dc.l CopEnd,-1
CopEnd:
dc.l 0,0
dc.w $29+256,CET_BREAK
dc.l 0,0
;fe
;fs "_Request"
_ReqHook:
ds.l 1
_ReqLastGui:
ds.l 1
_Request: ; a0=Title a1=body a2=buttons a3=Hook a4=datastream
move.l a3,_ReqHook
move.l _CurrentGui,_ReqLastGui
move.l a0,ReqTitle+ge_Data
move.l a1,ReqBody+ge_Data
move.l a4,ReqBody+ge_Data2
lea _GuiTemp,a0
lea ReqButtons(pc),a1
moveq #1,d1
lea _Button(pc),a3
.BLoop:
move.l a3,(a1)
move.l a0,ge_Data(a1)
.CLoop:
move.b (a2)+,d0
beq.s .CDone
cmp.b #"|",d0
beq.s .CDone
move.b d0,(a0)+
bra.s .CLoop
.CDone:
clr.b (a0)+
move.l d1,ge_ID(a1)
tst.b d0
beq.s .BDone
addq.l #1,d1
lea ge_Size(a1),a1
bra.s .BLoop
.BDone:
move.l a0,_CtGuiTemp
clr.l ge_ID(a1)
clr.l ge_Size(a1)
clr.l ge_Size*2(a1)
lea ReqGui(pc),a0
bra.s _ChangeGui
_ReqButHook:
move.l ge_ID(a0),d0
move.l _ReqLastGui,a0
bsr.s _ChangeGui
move.l _ReqHook,d1
beq.s .Done
move.l d1,-(a7)
.Done:
rts
ReqGui:
GENTRY _VGroup,0,0
GENTRY _HGroup,0,0
GENTRY _SmallButton,"X",_ReqButHook
GENTRY _SmallButton,"I",_Iconify
ReqTitle:
GENTRY _DragBar,0,0
GEND
ReqBody:
GENTRY _Text,0,0
GENTRY _HGroup,0,0
ReqButtons:
rept 20
GENTRY 0,0,_ReqButHook
endr
GEND
;fe
;fs "_HandleMouse"
_MouseHook:
dc.l 0
_HandleMouse:
move.l Low_Base,a6
moveq #0,d0
CALL ReadJoyPort
move.l _MouseX(pc),d6
move.l _MouseY(pc),d7
move.l d0,d1
and.l #JP_MHORZ_MASK,d1
lea LastHMCount(pc),a0
move.w (a0),d2
move.w d1,(a0)
sub.b d2,d1
extb.l d1
add.l d1,d6
and.l #JP_MVERT_MASK,d0
lsr.l #8,d0
lea LastVMCount(pc),a0
move.w (a0),d2
move.w d0,(a0)
sub.b d2,d0
extb.l d0
asr.l #1,d0
add.l d0,d7
movem.l _MinMouseX(pc),d0-3
cmp.l d0,d6
bge.s .XPos
move.l d0,d6
.XPos:
cmp.l d2,d6
ble.s .XOk
move.l d2,d6
.XOk:
move.l d6,_MouseX
cmp.l d1,d7
bge.s .YPos
move.l d1,d7
.YPos:
cmp.l d3,d7
ble.s .YOk
move.l d3,d7
.YOk:
move.l d7,_MouseY
subq.w #HotPointX,d6
lsl.w #1,d6
subq.w #HotPointY,d7
lea MouseGDwarf(pc),a0
movem.w d6-7,gdw_X(a0)
bsr _RefreshGardenDwarf
move.l _MouseHook(pc),d0
beq.s .Done
move.l d0,a0
jmp (a0)
.Done:
rts
_MinMouseX:
dc.l 0
_MinMouseY:
dc.l 0
_MaxMouseX:
dc.l GuiScreenWidth
_MaxMouseY:
dc.l 256
_MouseX:
dc.l GuiScreenWidth
_MouseY:
dc.l 256
LastHMCount:
ds.w 1
LastVMCount:
ds.w 1
MouseGDwarf:
dc.l _MouseGardenDwarfDat,0
dc.w 0,0,14
;fe
;fs "_HandleGui"
_PlayfieldClickHandler:
ds.l 1
_PreHandler:
ds.l 1
_ActiveThingHandler:
ds.l 1
_ActiveGuiEntry:
ds.l 1
_OldMButtonState:
ds.b 1
even
_HandleGui:
move.l _PreHandler(pc),d0
beq.s .Kzlonka
move.l d0,a0
jsr (a0)
.Kzlonka:
movem.l _MouseX(pc),d0-1
sub.l _GuiPos,d1
move.l _ActiveThingHandler(pc),d2
beq.s .AhBon
move.l d2,a1
move.l _ActiveGuiEntry(pc),a0
lea ge_Domain(a0),a2
move.l a2,_CurrentDomain
jmp (a1)
.AhBon:
move.b _OldMButtonState(pc),d2
btst #0,$dff016
seq _OldMButtonState
bne.s .PasClickuMilieu
tst.b d2
bne.s .PasClickuMilieu
cmp.l #CopEnd,_GuiLayerPtr
beq .ShowGui
move.l #CopEnd,_GuiLayerPtr
bra.s .PasClickuMilieu
.ShowGui:
move.l #CopLayer4,_GuiLayerPtr
.PasClickuMilieu:
move.l _PlayfieldClickHandler(pc),d2
beq.s .Décidement
cmp.l #CopEnd,_GuiLayerPtr
beq .GzlonK
tst.l d1
bpl.s .Décidement
.GzlonK:
movem.l _MouseX(pc),d0-1
move.l d2,a0
jmp (a0)
.Décidement:
cmp.l #CopEnd,_GuiLayerPtr
beq.s .OhEtPuisMerdeTousVouf
btst #6,$bfe001
bne.s .OhEtPuisMerdeTousVouf
move.l _CurrentGui(pc),d2
beq.s .OhEtPuisMerdeTousVouf
move.l d2,a0
cmp2.l ge_Domain+gd_Left(a0),d0
bcs.s .OhEtPuisMerdeTousVouf
cmp2.l ge_Domain+gd_Top(a0),d1
bcs.s .OhEtPuisMerdeTousVouf
bsr.s _DoClick
.OhEtPuisMerdeTousVouf:
rts
;fe
;fs "_RefreshGuiEntry"
_RefreshGuiEntry: ; a0=GuiEntry
movem.l d3-7/a1,-(a7)
move.l _CurrentDomain,-(a7)
lea ge_Domain(a0),a1
move.l a1,_CurrentDomain
bsr _ClearDomain
bsr _Layout
bsr _Render
move.l (a7)+,_CurrentDomain
movem.l (a7)+,d3-7/a1
rts
;fe
;fs "_ChangeGui"
_CurrentGui:
ds.l 1
_ChangeGui: ; a0=GuiTable
movem.l d0-7/a0-6,-(a7)
bsr.s _ClearGui
move.l #_GuiTemp,_CtGuiTemp
move.l #CopEnd,_GuiL1Ptr
move.l a0,_CurrentGui
bsr.s _GetMinMax
moveq #0,d0
move.l #255,d1
move.l ge_MaxHeight(a0),d2
beq.s .NoMax
move.l d1,d0
sub.l ge_MaxHeight(a0),d0
.NoMax:
move.l d0,_MinGuiPos
sub.l ge_MinHeight(a0),d1
move.l d1,_MaxGuiPos
move.l _GuiPos(pc),d2
cmp.l d0,d2
bcc.s .MinOk
move.l d0,d2
.MinOk:
cmp.l d2,d1
bcc.s .MaxOk
move.l d1,d2
.MaxOk:
move.l d2,_GuiPos
bsr.s _MoveGui
bsr.s _Layout
bsr.s _Render
movem.l (a7)+,d0-7/a0-6
rts
;fe
;fs "_MoveGui"
_GuiPos:
dc.l 256
_MinGuiPos:
dc.l 0
_MaxGuiPos:
dc.l 256
_MoveGui:
move.l _GuiPos(pc),d0
move.l d0,d1
add.l #$28,d0
move.w d0,GuiP
move.l _CurrentGui(pc),a0
move.l #2,ge_Domain+gd_Left(a0)
move.l #0,ge_Domain+gd_Top(a0)
move.l #GuiScreenWidth-2,ge_Domain+gd_Right(a0)
move.l #GuiScreenWidth-4,ge_Domain+gd_Width(a0)
move.l #255,d0
sub.l d1,d0
move.l d0,ge_Domain+gd_Height(a0)
move.l d0,ge_Domain+gd_Bottom(a0)
rts
;fe
;fs "_ClearGui"
_ClearGui:
move.l a0,-(a7)
move.l _CurrentGui(pc),d0
beq.s .Done
move.l d0,a0
lea ge_Domain(a0),a0
move.l a0,_CurrentDomain
bsr _ClearDomain
.Done:
move.l (a7)+,a0
rts
;fe
;fs "_GetMinMax"
_GetMinMax: ; a0=GuiEntry
movem.l d0-7/a0-6,-(a7)
move.l (a0),a1
move.l (a1),a1
jsr (a1)
movem.l (a7)+,d0-7/a0-6
rts
;fe
;fs "_Layout"
_Layout: ; a0=GuiEntry
movem.l d0-7/a0-6,-(a7)
move.l (a0),a1
move.l gc_Layout(a1),d0
beq.s .Done
move.l d0,a3
lea _CurrentDomain(pc),a1
move.l (a1),-(a7)
lea ge_Domain(a0),a2
move.l a2,(a1)
jsr (a3)
lea _CurrentDomain(pc),a1
move.l (a7)+,(a1)
.Done:
movem.l (a7)+,d0-7/a0-6
rts
;fe
;fs "_Render"
_Render: ; a0=GuiEntry
movem.l d0-7/a0-6,-(a7)
move.l (a0),a1
move.l gc_Render(a1),d0
beq.s .Done
move.l d0,a3
lea _CurrentDomain(pc),a1
move.l (a1),-(a7)
lea ge_Domain(a0),a2
move.l a2,(a1)
jsr (a3)
lea _CurrentDomain(pc),a1
move.l (a7)+,(a1)
.Done:
movem.l (a7)+,d0-7/a0-6
rts
;fe
;fs "_DoClick"
_DoClick: ; a0=GuiEntry d0/d1=X,Y
movem.l d0-1/d3-7/a0-6,-(a7)
move.l (a0),a1
move.l gc_Click(a1),d2
ble.s .Done
move.l d2,a3
lea _CurrentDomain(pc),a1
move.l (a1),-(a7)
lea ge_Domain(a0),a2
move.l a2,(a1)
jsr (a3)
lea _CurrentDomain(pc),a1
move.l (a7)+,(a1)
moveq #0,d2
.Done:
movem.l (a7)+,d0-1/d3-7/a0-6
rts
;fe
;fs "Classes"
;fs "_HGroup"
_HGroup:
dc.l HGGetMinMax
dc.l HGLayout
dc.l _GRender
dc.l _GClick
HGGetMinMax:
move.l a0,a1
lea ge_Size(a0),a0
moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d3
;bset #31,d3
not.l d3
sf d5
.Loop:
bsr.s _GetMinMax
add.l ge_MinWidth(a0),d0
move.l ge_MaxWidth(a0),d4
seq d6
or.b d6,d5
add.l d4,d2
move.l ge_MinHeight(a0),d4
cmp.l d4,d1
bcc.s .MiHOk
move.l d4,d1
.MiHOk:
move.l ge_MaxHeight(a0),d4
beq.s .MaHOk
cmp.l d3,d4
bcc.s .MaHOk
move.l d4,d3
.MaHOk:
move.l ge_Next(a0),a0
tst.l (a0)
beq.s .Done
addq.l #GuiHorSpacing,d0
addq.l #GuiHorSpacing,d2
bra.s .Loop
.Done:
tst.b d5
beq.s .WMaxOk
moveq #0,d2
.WMaxOk:
tst.l d3
bpl.s .HMaxOk
moveq #0,d3
.HMaxOk:
lea ge_Size(a0),a0
move.l a0,ge_Next(a1)
movem.l d0-3,ge_MinWidth(a1)
rts
HGLayout:
move.l a0,a6
lea ge_Size(a0),a0
move.l a0,a5
moveq #0,d7
move.l _CurrentDomain(pc),a1
move.l gd_Height(a1),d0
move.l gd_Top(a1),d1
move.l gd_Bottom(a1),d2
.InitLoop:
tst.l (a0)
beq.s .ILOk
move.l d1,ge_Domain+gd_Top(a0)
move.l d2,ge_Domain+gd_Bottom(a0)
clr.l ge_Domain+gd_Width(a0)
move.l d0,ge_Domain+gd_Height(a0)
addq.l #1,d7
move.l ge_Next(a0),a0
bra.s .InitLoop
.ILOk:
move.l gd_Width(a1),d5
move.l d7,d0
subq.l #1,d0
add.l d0,d0
sub.l d0,d5
.BigLoop:
tst.l d7
beq.s .MoreOrLessBigLoop
move.l d5,d4
divu d7,d4
ext.l d4
.MoreOrLessBigLoop:
move.l a5,a0
.Loop:
tst.l ge_Domain+gd_Width(a0)
bne.s .Fixed
move.l ge_MinWidth(a0),d0
cmp.l d0,d4
bcc.s .MinOk
move.l d0,ge_Domain+gd_Width(a0)
sub.l d0,d5
subq.l #1,d7
moveq #0,d1
move.l d1,ge_Domain+gd_Left(a0)
bra.s .BigLoop
.MinOk:
move.l ge_MaxWidth(a0),d0
beq.s .Next
cmp.l d4,d0
bcc.s .Next
move.l d0,ge_Domain+gd_Width(a0)
sub.l d0,d5
subq.l #1,d7
moveq #1,d1
move.l d1,ge_Domain+gd_Left(a0)
bra.s .BigLoop
.Fixed:
move.l ge_Domain+gd_Left(a0),d0
eor.l d1,d0
beq.s .Next
move.l ge_Domain+gd_Width(a0),d0
add.l d5,d0
move.l d7,d2
addq.l #1,d2
divu d2,d0
ext.l d0
move.l ge_MinWidth(a0),d2
cmp.l d2,d0
bcs.s .Next
move.l ge_MaxWidth(a0),d2
beq.s .AhhRâaah
cmp.l d0,d2
bcs.s .Next
.AhhRâaah:
add.l ge_Domain+gd_Width(a0),d5
clr.l ge_Domain+gd_Width(a0)
addq.l #1,d7
move.l d0,d4
bra.s .MoreOrLessBigLoop
.Next:
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .Loop
.Ok:
move.l a5,a0
move.l gd_Left(a1),d0
.PosLoop:
move.l d0,ge_Domain+gd_Left(a0)
move.l ge_Domain+gd_Width(a0),d1
bne.s .PLWOk
move.l d4,d1
move.l d4,ge_Domain+gd_Width(a0)
.PLWOk:
add.l d1,d0
move.l d0,ge_Domain+gd_Right(a0)
addq.l #GuiHorSpacing,d0
bsr _Layout
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .PosLoop
rts
;fe
;fs "_VGroup"
_VGroup:
dc.l VGGetMinMax
dc.l VGLayout
dc.l _GRender
dc.l _GClick
VGGetMinMax:
move.l a0,a1
lea ge_Size(a0),a0
moveq #0,d0
moveq #0,d1
moveq #0,d2
;bset #31,d2
not.l d2
moveq #0,d3
sf d5
.Loop:
bsr.s _GetMinMax
add.l ge_MinHeight(a0),d1
move.l ge_MaxHeight(a0),d4
seq d6
or.b d6,d5
add.l d4,d3
move.l ge_MinWidth(a0),d4
cmp.l d4,d0
bcc.s .MiWOk
move.l d4,d0
.MiWOk:
move.l ge_MaxWidth(a0),d4
beq.s .MaWOk
cmp.l d2,d4
bcc.s .MaWOk
move.l d4,d2
.MaWOk:
move.l ge_Next(a0),a0
tst.l (a0)
beq.s .Done
addq.l #GuiVerSpacing,d1
addq.l #GuiVerSpacing,d3
bra.s .Loop
.Done:
tst.b d5
beq.s .HMaxOk
moveq #0,d3
.HMaxOk:
tst.l d2
bpl.s .WMaxOk
moveq #0,d2
.WMaxOk:
lea ge_Size(a0),a0
move.l a0,ge_Next(a1)
movem.l d0-3,ge_MinWidth(a1)
rts
VGLayout:
move.l a0,a6
lea ge_Size(a0),a0
move.l a0,a5
moveq #0,d7
move.l _CurrentDomain(pc),a1
move.l gd_Width(a1),d0
move.l gd_Left(a1),d1
move.l gd_Right(a1),d2
.InitLoop:
tst.l (a0)
beq.s .ILOk
move.l d1,ge_Domain+gd_Left(a0)
move.l d2,ge_Domain+gd_Right(a0)
move.l d0,ge_Domain+gd_Width(a0)
clr.l ge_Domain+gd_Height(a0)
addq.l #1,d7
move.l ge_Next(a0),a0
bra.s .InitLoop
.ILOk:
move.l gd_Height(a1),d5
move.l d7,d0
subq.l #1,d0
sub.l d0,d5
.BigLoop:
tst.l d7
beq.s .MoreOrLessBigLoop
move.l d5,d4
divu d7,d4
ext.l d4
.MoreOrLessBigLoop:
move.l a5,a0
.Loop:
tst.l ge_Domain+gd_Height(a0)
bne.s .Fixed
move.l ge_MinHeight(a0),d0
cmp.l d0,d4
bcc.s .MinOk
move.l d0,ge_Domain+gd_Height(a0)
sub.l d0,d5
subq.l #1,d7
moveq #0,d1
move.l d1,ge_Domain+gd_Top(a0)
bra.s .BigLoop
.MinOk:
move.l ge_MaxHeight(a0),d0
beq.s .Next
cmp.l d4,d0
bcc.s .Next
move.l d0,ge_Domain+gd_Height(a0)
sub.l d0,d5
subq.l #1,d7
moveq #1,d1
move.l d1,ge_Domain+gd_Top(a0)
bra.s .BigLoop
.Fixed:
move.l ge_Domain+gd_Top(a0),d0
eor.l d1,d0
beq.s .Next
move.l ge_Domain+gd_Height(a0),d0
add.l d5,d0
move.l d7,d2
addq.l #1,d2
divu d2,d0
ext.l d0
move.l ge_MinHeight(a0),d2
cmp.l d2,d0
bcs.s .Next
move.l ge_MaxHeight(a0),d2
beq.s .AhhRâaah
cmp.l d0,d2
bcs.s .Next
.AhhRâaah:
add.l ge_Domain+gd_Height(a0),d5
clr.l ge_Domain+gd_Height(a0)
addq.l #1,d7
move.l d0,d4
bra.s .MoreOrLessBigLoop
.Next:
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .Loop
.Ok:
move.l a5,a0
move.l gd_Top(a1),d0
.PosLoop:
move.l d0,ge_Domain+gd_Top(a0)
move.l ge_Domain+gd_Height(a0),d1
bne.s .PLHOk
move.l d4,d1
move.l d4,ge_Domain+gd_Height(a0)
.PLHOk:
add.l d1,d0
move.l d0,ge_Domain+gd_Bottom(a0)
addq.l #GuiVerSpacing,d0
bsr _Layout
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .PosLoop
rts
;fe
;fs "_GRender"
_GRender:
lea ge_Size(a0),a0
.Loop:
bsr _Render
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .Loop
rts
;fe
;fs "_GClick"
_GClick:
lea ge_Size(a0),a0
.Loop:
cmp2.l ge_Domain+gd_Left(a0),d0
bcs.s .NoClick
cmp2.l ge_Domain+gd_Top(a0),d1
bcc.s .Bingo
.NoClick:
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .Loop
rts
.Bingo:
bsr.s _DoClick
tst.l d2
bmi.s .NoClick
rts
;fe
;fs "_Button"
_Button:
dc.l BGetMinMax
dc.l 0
dc.l BRender
dc.l BClick
BGetMinMax:
move.l ge_Data(a0),a1
move.l a1,a2
.StrLen:
tst.b (a1)+
bne.s .StrLen
sub.l a2,a1
move.l a1,d0
clr.l ge_MaxWidth(a0)
lsl.l #3,d0
move.l d0,ge_MinWidth(a0)
subq.l #8,d0
move.l d0,ge_Temp(a0)
moveq #12,d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
BRender:
move.l _CurrentDomain(pc),a1
moveq #0,d0
moveq #0,d1
move.l gd_Width(a1),d2
move.l gd_Height(a1),d3
sf d4
bsr _DrawBevelBox
sub.l ge_Temp(a0),d2
lsr.l #1,d2
move.l d2,d6
moveq #2,d7
move.l ge_Data(a0),a5
moveq #1,d4
moveq #0,d5
bsr _DrawText
rts
BClick:
move.l a0,_ActiveGuiEntry
lea BHandler(pc),a1
move.l a1,_ActiveThingHandler
sf BPressed
BHandler:
btst #6,$bfe001
bne.s .Desactivate
move.b BPressed(pc),d2
cmp2.l ge_Domain+gd_Left(a0),d0
scc d0
cmp2.l ge_Domain+gd_Top(a0),d1
scc d1
and.b d1,d0
move.b d0,BPressed
eor.b d0,d2
beq.s .Done
tst.b d0
bne.s .Press
.Release:
move.l _CurrentDomain(pc),a1
moveq #0,d3
moveq #2,d4
moveq #1,d5
movem.l gd_Width(a1),d6-7
subq.l #4,d6
subq.l #2,d7
bsr _DrawRectangle
bra BRender
.Press:
move.l _CurrentDomain(pc),a1
moveq #3,d3
moveq #2,d4
moveq #1,d5
movem.l gd_Width(a1),d6-7
subq.l #4,d6
subq.l #2,d7
bsr _DrawRectangle
move.l _CurrentDomain(pc),a1
moveq #0,d0
moveq #0,d1
move.l gd_Width(a1),d2
move.l gd_Height(a1),d3
st d4
bsr _DrawBevelBox
sub.l ge_Temp(a0),d2
lsr.l #1,d2
move.l d2,d6
moveq #2,d7
move.l ge_Data(a0),a5
moveq #1,d4
moveq #0,d5
bsr _DrawText
rts
.Desactivate:
clr.l _ActiveThingHandler
tst.b BPressed
beq.s .Done
bsr.s .Release
move.l ge_Hook(a0),d0
beq.s .Done
move.l d0,a1
jmp (a1)
.Done:
rts
BPressed:
ds.b 1
even
;fe
;fs "_SmallButton"
_SmallButton:
dc.l SBGetMinMax
dc.l SBLayout
dc.l SBRender
dc.l SBClick
SBGetMinMax:
moveq #16,d0
move.l d0,ge_MinWidth(a0)
tst.l ge_Data3(a0)
beq.s .Ok
moveq #0,d0
.Ok:
move.l d0,ge_MaxWidth(a0)
moveq #12,d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
SBLayout:
move.l ge_Domain+gd_Width(a0),d0
subq.l #8,d0
lsr.l #1,d0
move.l d0,ge_Temp(a0)
rts
SBRender:
move.l _CurrentDomain(pc),a1
moveq #0,d0
moveq #0,d1
move.l gd_Width(a1),d2
move.l gd_Height(a1),d3
sf d4
bsr _DrawBevelBox
move.l ge_Temp(a0),d6
moveq #2,d7
move.l ge_Data(a0),d5
moveq #1,d4
bsr _DrawChar
rts
SBClick:
move.l a0,_ActiveGuiEntry
lea SBHandler(pc),a1
move.l a1,_ActiveThingHandler
sf SBPressed
SBHandler:
btst #6,$bfe001
bne.s .Desactivate
move.b SBPressed(pc),d2
beq.s .Glonk
move.l ge_Data2(a0),d3
beq.s .Glonk
move.l d3,a1
movem.l d0-2/a0,-(a7)
jsr (a1)
movem.l (a7)+,d0-2/a0
.Glonk:
cmp2.l ge_Domain+gd_Left(a0),d0
scc d0
cmp2.l ge_Domain+gd_Top(a0),d1
scc d1
and.b d1,d0
move.b d0,SBPressed
eor.b d0,d2
beq.s .Done
tst.b d0
bne.s .Press
.Release:
move.l _CurrentDomain(pc),a1
moveq #0,d3
moveq #2,d4
moveq #1,d5
movem.l gd_Width(a1),d6-7
subq.l #4,d6
subq.l #2,d7
bsr _DrawRectangle
bra SBRender
.Press:
move.l _CurrentDomain(pc),a1
moveq #3,d3
moveq #2,d4
moveq #1,d5
movem.l gd_Width(a1),d6-7
subq.l #4,d6
subq.l #2,d7
bsr _DrawRectangle
move.l _CurrentDomain(pc),a1
moveq #0,d0
moveq #0,d1
move.l gd_Width(a1),d2
move.l gd_Height(a1),d3
st d4
bsr _DrawBevelBox
move.l ge_Temp(a0),d6
moveq #2,d7
move.l ge_Data(a0),d5
moveq #1,d4
bsr _DrawChar
rts
.Desactivate:
clr.l _ActiveThingHandler
tst.b SBPressed
beq.s .Done
bsr.s .Release
move.l ge_Hook(a0),d0
beq.s .Done
move.l d0,a1
jmp (a1)
.Done:
rts
SBPressed:
ds.b 1
even
;fe
;fs "_DragBar"
_DragBar:
dc.l BGetMinMax
dc.l 0
dc.l BRender
dc.l DBClick
DBClick:
move.l d0,_MinMouseX
move.l d0,_MaxMouseX
move.l a0,_ActiveGuiEntry
lea DBHandler(pc),a1
move.l a1,_ActiveThingHandler
move.l d1,DBOffset
move.w GuiSelP,d0
sub.w GuiP,d0
move.w d0,DBSelOffset
move.l d1,d0
add.l _MinGuiPos(pc),d0
move.l d0,_MinMouseY
add.l _MaxGuiPos(pc),d1
move.l d1,_MaxMouseY
lea DBMouseHook(pc),a0
move.l a0,_MouseHook
;move.l #CopEnd,_GuiL1Ptr
rts
DBHandler:
btst #6,$bfe001
beq.s .Ok
clr.l _MouseHook
clr.l _ActiveThingHandler
clr.l _MinMouseX
clr.l _MinMouseY
move.l #GuiScreenWidth,_MaxMouseX
move.l #256,_MaxMouseY
bsr _ClearGui
bsr _MoveGui
move.l _CurrentGui(pc),a0
bsr _Layout
bsr _Render
.Ok:
rts
DBMouseHook:
move.l _MouseY(pc),d0
sub.l DBOffset(pc),d0
move.l d0,_GuiPos
add.l #$28,d0
move.w d0,GuiP
add.w DBSelOffset,d0
move.w d0,GuiSelP
rts
DBOffset:
ds.l 1
DBSelOffset:
ds.w 1
;fe
;fs "_Text"
_Text:
dc.l TGetMinMax
dc.l 0
dc.l TRender
dc.l 0
TGetMinMax:
move.l ge_Data(a0),a1
move.l ge_Data2(a0),d0
beq.s .TrucEtTout
move.l a0,-(a7)
move.l (AbsExecBase).w,a6
move.l a1,a0
move.l d0,a1
lea TPutChar(pc),a2
lea _StrBuf,a3
CALL RawDoFmt
move.l (a7)+,a0
lea _StrBuf,a1
lea CustomBase,a6
moveq #0,d0
.TrucEtTout:
moveq #0,d1
.LLoop:
addq.l #1,d0
move.l a1,a2
.CLoop:
move.b (a2)+,d2
beq.s .CLDone
cmp.b #$a,d2
bne.s .CLoop
.CLDone:
move.l a2,d3
sub.l a1,d3
cmp.l d3,d1
bcc.s .Baâââh
move.l d3,d1
.Baâââh:
move.l a2,a1
tst.b d2
bne.s .LLoop
lsl.l #3,d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
subq.l #1,d1
lsl.l #3,d1
clr.l ge_MaxWidth(a0)
move.l d1,ge_MinWidth(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
TRender:
move.l _CurrentDomain(pc),a1
move.l gd_Width(a1),d1
move.l ge_Data(a0),a5
moveq #0,d7
move.l ge_Data2(a0),d0
beq.s .LLoop
movem.l d1/a1,-(a7)
move.l (AbsExecBase).w,a6
move.l a5,a0
move.l d0,a1
lea TPutChar(pc),a2
lea _StrBuf,a3
CALL RawDoFmt
lea _StrBuf,a5
lea CustomBase,a6
movem.l (a7)+,d1/a1
.LLoop:
move.l a5,a1
.CLoop:
move.b (a1)+,d2
beq.s .CLDone
cmp.b #$a,d2
bne.s .CLoop
.CLDone:
move.l a1,d5
sub.l a5,d5
subq.l #1,d5
beq.s .Poisse
move.l d5,d0
lsl.l #3,d0
move.l d1,d6
sub.l d0,d6
lsr.l #1,d6
moveq #1,d4
bsr _DrawText
.Poisse:
move.l a1,a5
addq.l #8,d7
tst.b d2
bne.s .LLoop
rts
TPutChar:
move.b d0,(a3)+
rts
;fe
;fs "_FText"
_FText:
dc.l FTGetMinMax
dc.l 0
dc.l TRender
dc.l 0
FTGetMinMax:
bsr.s TGetMinMax
move.l ge_MinWidth(a0),ge_MaxWidth(a0)
rts
;fe
;fs "_HProp"
_HProp:
dc.l HPGetMinMax
dc.l HPLayout
dc.l HPRender
dc.l HPClick
HPGetMinMax:
moveq #50,d0
move.l d0,ge_MinWidth(a0)
moveq #0,d0
move.l d0,ge_MaxWidth(a0)
moveq #12,d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
HPLayout:
move.l ge_Domain+gd_Width(a0),d0
sub.l #8,d0
move.l d0,d1
move.l ge_Data2(a0),d2
move.l ge_Data3(a0),d3
cmp.l d2,d3
bcc.s .FullKnob
mulu d3,d1
divu d2,d1
ext.l d1
cmp.l #14,d1
bcc.s .FullKnob
moveq #14,d1
.FullKnob:
move.l d1,ge_Temp3(a0)
sub.l d1,d0
move.l d0,ge_Temp(a0)
HPCalcKnobPos:
movem.l ge_Data2(a0),d1-2
move.l ge_Data(a0),d0
bpl.s .MinOk
moveq #0,d0
.MinOk:
move.l d1,d3
sub.l d2,d3
bpl.s .Ok
moveq #0,d3
.Ok:
cmp.l d0,d3
bcc.s .MaxOk
move.l d3,d0
.MaxOk:
move.l d0,ge_Data(a0)
mulu ge_Temp+2(a0),d0
sub.l d2,d1
beq.s .FullKnob
divu d1,d0
ext.l d0
move.l ge_Temp(a0),d1
cmp.l d0,d1
bcc.s .MaxPosOk
move.l d1,d0
.MaxPosOk:
addq.l #4,d0
move.l d0,ge_Temp2(a0)
rts
.FullKnob:
moveq #2,d0
move.l d0,ge_Temp2(a0)
rts
HPRender:
moveq #0,d0
moveq #0,d1
movem.l ge_Domain+gd_Width(a0),d2-3
sf d4
bsr.s _DrawBevelBox
moveq #2,d0
moveq #1,d1
movem.l ge_Domain+gd_Width(a0),d2-3
subq.l #4,d2
subq.l #2,d3
st d4
bsr.s _DrawBevelBox
HPRenderKnob:
moveq #2,d1
moveq #8,d3
movem.l ge_Temp2(a0),d0/d2
sf d4
bsr.s _DrawBevelBox
moveq #4,d1
move.l ge_Temp3(a0),d0
subq.l #6,d0
lsr.l #1,d0
add.l ge_Temp2(a0),d0
bra.s _DrawPropHole
HPRenderKnobSelected:
moveq #2,d1
moveq #8,d3
movem.l ge_Temp2(a0),d0/d2
sf d4
bsr.s _DrawBevelBox
moveq #3,d5
moveq #6,d7
movem.l ge_Temp2(a0),d4/d6
addq.l #2,d4
subq.l #4,d6
moveq #3,d3
bsr.s _DrawRectangle
moveq #4,d1
move.l ge_Temp3(a0),d0
subq.l #6,d0
lsr.l #1,d0
add.l ge_Temp2(a0),d0
bra.s _DrawPropHole
HPClearKnob:
moveq #2,d5
moveq #8,d7
movem.l ge_Temp2(a0),d4/d6
moveq #0,d3
bra.s _DrawRectangle
HPClick:
move.l d0,d3
sub.l ge_Domain+gd_Left(a0),d0
move.l ge_Temp2(a0),d2
cmp.l d2,d0
bcs.s .BeforeKnob
add.l ge_Temp3(a0),d2
cmp.l d2,d0
bcc.s .AfterKnob
sub.l ge_Temp2(a0),d3
move.l d3,HPOffset
add.l _GuiPos(pc),d1
move.l d1,_MinMouseY
move.l d1,_MaxMouseY
addq.l #4,d3
move.l d3,d1
move.l d3,_MinMouseX
add.l ge_Temp(a0),d1
move.l d1,_MaxMouseX
move.l a0,_ActiveGuiEntry
lea HPHandler(pc),a1
move.l a1,_ActiveThingHandler
bra HPRenderKnobSelected
.BeforeKnob:
move.l ge_Data3(a0),d1
subq.l #1,d1
bne.s .BKOkIncr
moveq #1,d1
.BKOkIncr:
move.l ge_Data(a0),d0
sub.l d1,d0
.KnobOk:
move.l d0,ge_Data(a0)
bsr HPClearKnob
bsr HPCalcKnobPos
lea HPWaitHandler(pc),a1
move.l a1,_ActiveThingHandler
move.l ge_Hook(a0),d0
beq HPRenderKnob
move.l d0,a1
move.l ge_Data(a0),d0
move.l a0,-(a7)
jsr (a1)
move.l (a7)+,a0
bra HPRenderKnob
.AfterKnob:
move.l ge_Data3(a0),d1
subq.l #1,d1
bne.s .AKOkIncr
moveq #1,d1
.AKOkIncr:
move.l ge_Data(a0),d0
add.l d1,d0
bra.s .KnobOk
HPWaitHandler:
btst #6,$bfe001
beq.s .Done
clr.l _ActiveThingHandler
.Done:
rts
HPHandler:
btst #6,$bfe001
bne.s .Release
sub.l HPOffset(pc),d0
cmp.l ge_Temp2(a0),d0
beq.s .Done
bsr.s HPClearKnob
move.l d0,ge_Temp2(a0)
bsr.s HPRenderKnobSelected
move.l ge_Temp2(a0),d0
subq.l #4,d0
move.l ge_Data2(a0),d1
sub.l ge_Data3(a0),d1
mulu d1,d0
move.l ge_Temp(a0),d1
divu d1,d0
ext.l d0
move.l d0,ge_Data(a0)
move.l ge_Hook(a0),d1
beq.s .Done
move.l d1,a1
jmp (a1)
.Done:
rts
.Release:
clr.l _MinMouseX
clr.l _MinMouseY
move.l #GuiScreenWidth,_MaxMouseX
move.l #256,_MaxMouseY
clr.l _ActiveThingHandler
clr.l _ActiveGuiEntry
bsr.s HPClearKnob
bra.s HPRenderKnob
HPOffset:
ds.l 1
;fe
;fs "_VProp"
_VProp:
dc.l VPGetMinMax
dc.l VPLayout
dc.l VPRender
dc.l VPClick
VPGetMinMax:
moveq #19,d0
move.l d0,ge_MinHeight(a0)
moveq #0,d0
move.l d0,ge_MaxHeight(a0)
moveq #20,d0
move.l d0,ge_MinWidth(a0)
move.l d0,ge_MaxWidth(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
VPLayout:
move.l ge_Domain+gd_Height(a0),d0
sub.l #4,d0
move.l d0,d1
move.l ge_Data2(a0),d2
move.l ge_Data3(a0),d3
cmp.l d2,d3
bcc.s .FullKnob
mulu d3,d1
divu d2,d1
ext.l d1
cmp.l #8,d1
bcc.s .FullKnob
moveq #8,d1
.FullKnob:
move.l d1,ge_Temp3(a0)
sub.l d1,d0
move.l d0,ge_Temp(a0)
VPCalcKnobPos:
movem.l ge_Data2(a0),d1-2
move.l ge_Data(a0),d0
bpl.s .MinOk
moveq #0,d0
.MinOk:
move.l d1,d3
sub.l d2,d3
bpl.s .Ok
moveq #0,d3
.Ok:
cmp.l d0,d3
bcc.s .MaxOk
move.l d3,d0
.MaxOk:
move.l d0,ge_Data(a0)
mulu ge_Temp+2(a0),d0
sub.l d2,d1
beq.s .FullKnob
divu d1,d0
ext.l d0
move.l ge_Temp(a0),d1
cmp.l d0,d1
bcc.s .MaxPosOk
move.l d1,d0
.MaxPosOk:
addq.l #2,d0
move.l d0,ge_Temp2(a0)
rts
.FullKnob:
moveq #2,d0
move.l d0,ge_Temp2(a0)
rts
VPRender:
moveq #0,d0
moveq #0,d1
movem.l ge_Domain+gd_Width(a0),d2-3
sf d4
bsr.s _DrawBevelBox
moveq #2,d0
moveq #1,d1
movem.l ge_Domain+gd_Width(a0),d2-3
subq.l #4,d2
subq.l #2,d3
st d4
bsr.s _DrawBevelBox
VPRenderKnob:
moveq #4,d0
move.l #12,d2
movem.l ge_Temp2(a0),d1/d3
sf d4
bsr.s _DrawBevelBox
moveq #7,d0
move.l ge_Temp3(a0),d1
subq.l #4,d1
lsr.l #1,d1
add.l ge_Temp2(a0),d1
bra.s _DrawPropHole
VPRenderKnobSelected:
moveq #4,d0
moveq #12,d2
movem.l ge_Temp2(a0),d1/d3
sf d4
bsr.s _DrawBevelBox
moveq #6,d4
moveq #8,d6
movem.l ge_Temp2(a0),d5/d7
addq.l #1,d5
subq.l #2,d7
moveq #3,d3
bsr.s _DrawRectangle
moveq #7,d0
move.l ge_Temp3(a0),d1
subq.l #4,d1
lsr.l #1,d1
add.l ge_Temp2(a0),d1
bra.s _DrawPropHole
VPClearKnob:
moveq #4,d4
moveq #12,d6
movem.l ge_Temp2(a0),d5/d7
moveq #0,d3
bra.s _DrawRectangle
VPClick:
move.l d1,d3
sub.l ge_Domain+gd_Top(a0),d1
move.l ge_Temp2(a0),d2
cmp.l d2,d1
bcs.s .BeforeKnob
add.l ge_Temp3(a0),d2
cmp.l d2,d1
bcc.s .AfterKnob
sub.l ge_Temp2(a0),d3
move.l d3,VPOffset
move.l d0,_MinMouseX
move.l d0,_MaxMouseX
add.l _GuiPos(pc),d3
addq.l #2,d3
move.l d3,d1
move.l d3,_MinMouseY
add.l ge_Temp(a0),d1
move.l d1,_MaxMouseY
move.l a0,_ActiveGuiEntry
lea VPHandler(pc),a1
move.l a1,_ActiveThingHandler
bra VPRenderKnobSelected
.BeforeKnob:
move.l ge_Data3(a0),d1
subq.l #1,d1
bne.s .BKOkIncr
moveq #1,d1
.BKOkIncr:
move.l ge_Data(a0),d0
sub.l d1,d0
.KnobOk:
move.l d0,ge_Data(a0)
bsr VPClearKnob
bsr VPCalcKnobPos
lea VPWaitHandler(pc),a1
move.l a1,_ActiveThingHandler
move.l ge_Hook(a0),d0
beq VPRenderKnob
move.l d0,a1
move.l ge_Data(a0),d0
move.l a0,-(a7)
jsr (a1)
move.l (a7)+,a0
bra VPRenderKnob
.AfterKnob:
move.l ge_Data3(a0),d1
subq.l #1,d1
bne.s .AKOkIncr
moveq #1,d1
.AKOkIncr:
move.l ge_Data(a0),d0
add.l d1,d0
bra.s .KnobOk
VPWaitHandler:
btst #6,$bfe001
beq.s .Done
clr.l _ActiveThingHandler
.Done:
rts
VPHandler:
btst #6,$bfe001
bne.s .Release
sub.l VPOffset(pc),d1
cmp.l ge_Temp2(a0),d1
beq.s .Done
bsr.s VPClearKnob
move.l d1,ge_Temp2(a0)
bsr.s VPRenderKnobSelected
move.l ge_Temp2(a0),d1
subq.l #2,d1
move.l ge_Data2(a0),d0
sub.l ge_Data3(a0),d0
mulu d0,d1
move.l ge_Temp(a0),d0
divu d0,d1
ext.l d1
move.l d1,ge_Data(a0)
move.l d1,d0
move.l ge_Hook(a0),d1
beq.s .Done
move.l d1,a1
jmp (a1)
.Done:
rts
.Release:
clr.l _MinMouseX
clr.l _MinMouseY
move.l #GuiScreenWidth,_MaxMouseX
move.l #256,_MaxMouseY
clr.l _ActiveThingHandler
clr.l _ActiveGuiEntry
bsr.s VPClearKnob
bra.s VPRenderKnob
VPOffset:
ds.l 1
;fe
;fs "_DrawPropHole"
_DrawPropHole: ; d0/d1=X,Y
movem.l d0-3/a0,-(a7)
move.l _CurrentDomain(pc),a0
add.l gd_Left(a0),d0
add.l gd_Top(a0),d1
move.l _GuiBitmap(pc),a0
mulu #GuiLineSize,d1
add.l d1,a0
move.l d0,d1
lsr.l #3,d1
add.l d1,a0
not.l d0
and.l #7,d0
addq.l #3,d0
.RWait:
tst.l _RectCount
bne.s .RWait
moveq #$1c,d1
lsl.w d0,d1
or.w d1,(a0)
lea GuiBufferWidth(a0),a0
not.w d1
and.w d1,(a0)
lea GuiBufferWidth(a0),a0
moveq #$3f,d1
lsl.w d0,d1
not.w d1
move.w (a0),d3
and.w d1,d3
moveq #$38,d2
lsl.w d0,d2
or.w d2,d3
move.w d3,(a0)
lea GuiBufferWidth(a0),a0
move.w (a0),d3
and.w d1,d3
moveq #3,d2
lsl.w d0,d2
or.w d2,d3
move.w d3,(a0)
lea GuiBufferWidth(a0),a0
move.w (a0),d3
and.w d1,d3
moveq #$30,d2
lsl.w d0,d2
or.w d2,d3
move.w d3,(a0)
lea GuiBufferWidth(a0),a0
move.w (a0),d3
and.w d1,d3
moveq #7,d2
lsl.w d0,d2
or.w d2,d3
move.w d3,(a0)
lea GuiBufferWidth(a0),a0
moveq #$e,d1
lsl.w d0,d1
move.w d1,d2
not.w d2
and.w d2,(a0)
lea GuiBufferWidth(a0),a0
or.w d1,(a0)
movem.l (a7)+,d0-3/a0
rts
;fe
;fs "_HScroller"
_HScroller:
dc.l HSCGetMinMax
dc.l HSCLayout
dc.l HSCRender
dc.l HSCClick
HSCGetMinMax:
moveq #0,d0
move.l _CtGuiTemp(pc),a1
move.l a1,ge_Temp(a0)
lea ge_Size*7(a1),a2
move.l a2,_CtGuiTemp
move.l #_HGroup,(a1)
lea ge_Size(a1),a1
move.l a1,ge_Temp2(a0)
move.l #_HProp,(a1)
move.l ge_Data(a0),ge_Data(a1)
move.l ge_Data2(a0),ge_Data2(a1)
move.l ge_Data3(a0),ge_Data3(a1)
move.l a0,ge_ID(a1)
move.l #HSCHook,ge_Hook(a1)
lea ge_Size(a1),a1
move.l #_HSpacingEater,(a1)
lea ge_Size(a1),a1
move.l #_SmallButton,(a1)
move.l #$8e,ge_Data(a1)
move.l a0,ge_ID(a1)
move.l #HSCRelHook,ge_Hook(a1)
move.l #HSCDecrHook,ge_Data2(a1)
move.l d0,ge_Data3(a1)
lea ge_Size(a1),a1
move.l #_HSpacingEater,(a1)
lea ge_Size(a1),a1
move.l #_SmallButton,(a1)
move.l #$8d,ge_Data(a1)
move.l a0,ge_ID(a1)
move.l #HSCRelHook,ge_Hook(a1)
move.l #HSCIncrHook,ge_Data2(a1)
move.l d0,ge_Data3(a1)
lea ge_Size(a1),a1
clr.l (a1)
move.l a0,a1
move.l ge_Temp(a1),a0
bsr _GetMinMax
move.l ge_MinWidth(a0),ge_MinWidth(a1)
move.l ge_MaxWidth(a0),ge_MaxWidth(a1)
move.l ge_MinHeight(a0),ge_MinHeight(a1)
move.l ge_MaxHeight(a0),ge_MaxHeight(a1)
lea ge_Size(a1),a0
move.l a0,ge_Next(a1)
rts
HSCLayout:
move.l a0,a2
move.l ge_Temp2(a0),a3
movem.l ge_Data(a0),d0-2
movem.l d0-2,ge_Data(a3)
move.l a0,a1
move.l ge_Temp(a1),a0
movem.l ge_Domain(a1),d0-5
movem.l d0-5,ge_Domain(a0)
bsr _Layout
move.l ge_Data(a3),ge_Data(a2)
rts
HSCRender:
move.l ge_Temp(a0),a0
bra _Render
HSCClick:
move.l ge_Temp(a0),a0
bra _DoClick
HSCHook:
move.l ge_ID(a0),a1
movem.l ge_Data(a0),d0-2
movem.l d0-2,ge_Data(a1)
HSCCallHook:
move.l ge_Hook(a1),d1
beq.s .Done
move.l a1,a0
move.l d1,a1
jmp (a1)
.Done:
rts
HSCDecrHook:
sub.l #1,HSCHookCount
bpl.s .Done
move.l #5,HSCHookCount
move.l ge_ID(a0),a1
move.l ge_Temp2(a1),a0
sub.l #1,ge_Data(a0)
bsr _RefreshGuiEntry
move.l ge_Data(a0),d0
move.l d0,ge_Data(a1)
bra.s HSCCallHook
.Done:
rts
HSCIncrHook:
sub.l #1,HSCHookCount
bpl.s .Done
move.l #5,HSCHookCount
move.l ge_ID(a0),a1
move.l ge_Temp2(a1),a0
add.l #1,ge_Data(a0)
bsr _RefreshGuiEntry
move.l ge_Data(a0),d0
move.l d0,ge_Data(a1)
bra.s HSCCallHook
.Done:
rts
HSCRelHook:
clr.l HSCHookCount
rts
HSCHookCount:
dc.l 0
;fe
;fs "_VScroller"
_VScroller:
dc.l VSCGetMinMax
dc.l VSCLayout
dc.l VSCRender
dc.l VSCClick
VSCGetMinMax:
moveq #1,d0
move.l _CtGuiTemp(pc),a1
move.l a1,ge_Temp(a0)
lea ge_Size*7(a1),a2
move.l a2,_CtGuiTemp
move.l #_VGroup,(a1)
lea ge_Size(a1),a1
move.l a1,ge_Temp2(a0)
move.l #_VProp,(a1)
move.l ge_Data(a0),ge_Data(a1)
move.l ge_Data2(a0),ge_Data2(a1)
move.l ge_Data3(a0),ge_Data3(a1)
move.l a0,ge_ID(a1)
move.l #VSCHook,ge_Hook(a1)
lea ge_Size(a1),a1
move.l #_VSpacingEater,(a1)
lea ge_Size(a1),a1
move.l #_SmallButton,(a1)
move.l #$90,ge_Data(a1)
move.l a0,ge_ID(a1)
move.l #VSCRelHook,ge_Hook(a1)
move.l #VSCDecrHook,ge_Data2(a1)
move.l d0,ge_Data3(a1)
lea ge_Size(a1),a1
move.l #_VSpacingEater,(a1)
lea ge_Size(a1),a1
move.l #_SmallButton,(a1)
move.l #$8f,ge_Data(a1)
move.l a0,ge_ID(a1)
move.l #VSCRelHook,ge_Hook(a1)
move.l #VSCIncrHook,ge_Data2(a1)
move.l d0,ge_Data3(a1)
lea ge_Size(a1),a1
clr.l (a1)
move.l a0,a1
move.l ge_Temp(a1),a0
bsr _GetMinMax
move.l ge_MinWidth(a0),ge_MinWidth(a1)
move.l ge_MaxWidth(a0),ge_MaxWidth(a1)
move.l ge_MinHeight(a0),ge_MinHeight(a1)
move.l ge_MaxHeight(a0),ge_MaxHeight(a1)
lea ge_Size(a1),a0
move.l a0,ge_Next(a1)
rts
VSCLayout:
move.l a0,a2
move.l ge_Temp2(a0),a3
movem.l ge_Data(a0),d0-2
movem.l d0-2,ge_Data(a3)
move.l a0,a1
move.l ge_Temp(a1),a0
movem.l ge_Domain(a1),d0-5
movem.l d0-5,ge_Domain(a0)
bsr _Layout
move.l ge_Data(a3),ge_Data(a2)
rts
VSCRender:
move.l ge_Temp(a0),a0
bra _Render
VSCClick:
move.l ge_Temp(a0),a0
bra _DoClick
VSCHook:
move.l ge_ID(a0),a1
movem.l ge_Data(a0),d0-2
movem.l d0-2,ge_Data(a1)
VSCCallHook:
move.l ge_Hook(a1),d1
beq.s .Done
move.l a1,a0
move.l d1,a1
jmp (a1)
.Done:
rts
VSCDecrHook:
sub.l #1,VSCHookCount
bpl.s .Done
move.l #5,VSCHookCount
move.l ge_ID(a0),a1
move.l ge_Temp2(a1),a0
sub.l #1,ge_Data(a0)
bsr _RefreshGuiEntry
move.l ge_Data(a0),d0
move.l d0,ge_Data(a1)
bra.s VSCCallHook
.Done:
rts
VSCIncrHook:
sub.l #1,VSCHookCount
bpl.s .Done
move.l #5,VSCHookCount
move.l ge_ID(a0),a1
move.l ge_Temp2(a1),a0
add.l #1,ge_Data(a0)
bsr _RefreshGuiEntry
move.l ge_Data(a0),d0
move.l d0,ge_Data(a1)
bra.s VSCCallHook
.Done:
rts
VSCRelHook:
clr.l VSCHookCount
rts
VSCHookCount:
dc.l 0
;fe
;fs "_ListView"
_ListView:
dc.l LVGetMinMax
dc.l LVLayout
dc.l LVRender
dc.l LVClick
LVGetMinMax:
moveq #1,d0
move.l _CtGuiTemp(pc),a1
move.l a1,ge_Temp(a0)
lea ge_Size*5(a1),a2
move.l a2,_CtGuiTemp
move.l #_HGroup,(a1)
lea ge_Size(a1),a1
move.l a1,ge_Temp2(a0)
move.l #IntListView,(a1)
move.l ge_Data3(a0),ge_Temp3(a1)
move.l a0,ge_ID(a1)
move.l ge_Hook(a0),ge_Hook(a1)
lea ge_Size(a1),a1
move.l #_HSpacingEater,(a1)
lea ge_Size(a1),a1
move.l a1,ge_Temp3(a0)
move.l #_VScroller,(a1)
move.l ge_Data2(a0),ge_Data(a1)
move.l a0,ge_ID(a1)
move.l #LVHook,ge_Hook(a1)
lea ge_Size(a1),a1
clr.l (a1)
move.l a0,a1
move.l ge_Temp(a1),a0
bsr _GetMinMax
move.l ge_MinWidth(a0),ge_MinWidth(a1)
move.l ge_MaxWidth(a0),ge_MaxWidth(a1)
move.l ge_MinHeight(a0),ge_MinHeight(a1)
move.l ge_MaxHeight(a0),ge_MaxHeight(a1)
lea ge_Size(a1),a0
move.l a0,ge_Next(a1)
rts
LVLayout:
move.l ge_Data(a0),a1
moveq #0,d6
move.l (a1),a1
move.l (a1),d7
beq.s .EmptyList
move.l d7,d0
move.l a1,d7
.CountEntries:
addq.l #1,d6
move.l d0,a1
move.l (a1),d0
bne.s .CountEntries
.EmptyList:
move.l a0,a3
move.l ge_Temp(a0),a0
movem.l ge_Domain(a3),d0-5
movem.l d0-5,ge_Domain(a0)
subq.l #3,d5
lsr.l #3,d5
move.l ge_Temp2(a3),a1
move.l d5,ge_Temp(a1)
move.l d7,ge_Temp2(a1)
lea ge_Size*2(a1),a1
move.l d6,ge_Data2(a1)
move.l d5,ge_Data3(a1)
bsr _Layout
move.l a3,a0
LVFirstVisAddress:
move.l ge_Temp3(a0),a2
sub.l a1,a1
tst.l ge_Data2(a2)
beq.s .EmptyList
move.l ge_Data(a2),d0
move.l ge_Data(a0),a1
.Loop:
move.l (a1),a1
dbf d0,.Loop
.EmptyList:
move.l ge_Temp2(a0),a2
move.l a1,ge_Temp2(a2)
rts
LVRender:
move.l a0,a1
move.l ge_Temp3(a1),a0
bsr _RefreshGuiEntry
move.l ge_Temp2(a1),a0
bra _Render
LVClick:
move.l ge_Temp(a0),a0
bra _DoClick
LVHook:
move.l _CurrentDomain,-(a7)
move.l a0,a1
move.l ge_ID(a1),a0
move.l ge_Data(a1),ge_Data2(a0)
bsr.s LVFirstVisAddress
move.l ge_Temp2(a0),a0
lea ge_Domain(a0),a1
move.l a1,_CurrentDomain
bsr ILVClear
bsr ILVRenderEntries
move.l (a7)+,_CurrentDomain
rts
IntListView:
dc.l ILVGetMinMax
dc.l 0
dc.l ILVRender
dc.l ILVClick
ILVGetMinMax:
move.l #40,ge_MinWidth(a0)
move.l #12,ge_MinHeight(a0)
clr.l ge_MaxWidth(a0)
clr.l ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
ILVRender:
moveq #0,d0
moveq #0,d1
move.l ge_Domain+gd_Width(a0),d2
move.l ge_Domain+gd_Height(a0),d3
sf d4
bsr _DrawBevelBox
ILVRenderEntries:
moveq #-1,d0
move.l d0,ge_Data2(a0)
move.l ge_Domain+gd_Width(a0),d0
subq.l #6,d0
move.l d0,_TextLimit
move.l ge_Temp2(a0),d0
beq.s .EmptyList
move.l d0,a1
move.l (a1),d0
move.l ge_Temp(a0),d1
subq.l #1,d1
move.l ge_Temp3(a0),a2
moveq #1,d2
.Loop:
moveq #0,d3
cmp.l a1,a2
bne.s .NoSel
moveq #3,d3
.NoSel:
moveq #2,d4
move.l d2,d5
move.l ge_Domain+gd_Width(a0),d6
subq.l #4,d6
moveq #8,d7
move.l d5,ge_Data2(a0)
bsr _DrawRectangle
;.NoSel:
move.l lve_Color(a1),d4
moveq #0,d5
move.l lve_String(a1),a5
moveq #2,d6
move.l d2,d7
bsr.s _DrawText
addq.l #8,d2
move.l d0,a1
move.l (a1),d0
dbeq d1,.Loop
.EmptyList:
clr.l _TextLimit
rts
ILVClear:
rts
moveq #0,d3
movem.l ge_Domain+gd_Width(a0),d6-7
moveq #2,d4
moveq #1,d5
subq.l #4,d6
subq.l #2,d7
bsr _DrawRectangle
rts
ILVClick:
move.l d1,d2
subq.l #1,d2
bpl.s .Clicku
rts
.Clicku:
move.l a0,_ActiveGuiEntry
move.l #ILVHandler,_ActiveThingHandler
ILVHandler:
btst #6,$bfe001
bne.s .Release
sub.l ge_Domain+gd_Top(a0),d1
subq.l #1,d1
bmi.s .Before
lsr.l #3,d1
move.l ge_Temp(a0),d0
subq.l #1,d0
cmp.l d1,d0
bcs.s .After
move.l ge_Temp2(a0),d0
beq .Done
clr.l ILVHookCount
move.l d1,d2
move.l d0,a1
subq.l #1,d1
bmi.s .Vivi
move.l (a1),d0
.Loop:
move.l d0,a1
move.l (a1),d0
dbeq d1,.Loop
bne.s .Vivi
move.l lve_Prev(a1),a1
.Vivi:
cmp.l ge_Temp3(a0),a1
beq.s .Done
move.l a1,ge_Temp3(a0)
moveq #0,d3
moveq #2,d4
move.l ge_Data2(a0),d5
bmi ILVRenderEntries
moveq #8,d7
move.l ge_Domain+gd_Width(a0),d6
subq.l #4,d6
bsr _DrawRectangle
bra ILVRenderEntries
.Before:
sub.l #1,ILVHookCount
bpl.s .Done
move.l #5,ILVHookCount
move.l a0,a3
move.l ge_ID(a3),a1
move.l ge_Temp3(a1),a0
move.l ge_Data(a0),d7
move.l d7,d0
subq.l #1,d0
move.l d0,ge_Data(a0)
bsr _RefreshGuiEntry
cmp.l ge_Data(a0),d7
beq.s .Done
move.l a1,a0
bsr LVFirstVisAddress
move.l a3,a0
move.l ge_Temp2(a0),ge_Temp3(a0)
bsr ILVClear
bra ILVRenderEntries
.After:
sub.l #1,ILVHookCount
bpl.s .Done
move.l #5,ILVHookCount
move.l a0,a3
move.l ge_ID(a3),a1
move.l ge_Temp3(a1),a0
move.l ge_Data(a0),d7
move.l d7,d0
addq.l #1,d0
move.l d0,ge_Data(a0)
bsr _RefreshGuiEntry
cmp.l ge_Data(a0),d7
beq.s .Done
move.l a1,a0
bsr LVFirstVisAddress
move.l a3,a0
move.l ge_Temp3(a0),a1
move.l (a1),a1
tst.l (a1)
beq.s .MaisEuh
move.l a1,ge_Temp3(a0)
.MaisEuh:
bsr ILVClear
bra ILVRenderEntries
.Release:
clr.l _ActiveThingHandler
clr.l _ActiveGuiEntry
clr.l ILVHookCount
move.l ge_ID(a0),a1
move.l ge_Temp3(a0),d0
move.l d0,ge_Data3(a1)
move.l ge_Temp3(a1),a2
move.l ge_Data(a2),ge_Data2(a1)
move.l d0,a0
move.l ge_Hook(a1),d0
beq.s .Done
move.l d0,a1
jmp (a1)
.Done:
rts
ILVHookCount:
dc.l 0
;fe
;fs "_HSpacingEater"
_HSpacingEater:
dc.l HSEGetMinMax
dc.l 0
dc.l 0
dc.l -1
HSEGetMinMax:
moveq #-GuiHorSpacing*2,d0
move.l d0,ge_MinWidth(a0)
move.l d0,ge_MaxWidth(a0)
clr.l ge_MinHeight(a0)
clr.l ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
;fe
;fs "_VSpacingEater"
_VSpacingEater:
dc.l VSEGetMinMax
dc.l 0
dc.l 0
dc.l -1
VSEGetMinMax:
clr.l ge_MinWidth(a0)
clr.l ge_MaxWidth(a0)
moveq #-GuiVerSpacing*2,d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
;fe
;fs "_Empty"
_Empty:
dc.l EGetMinMax
dc.l 0
dc.l 0
dc.l 0
EGetMinMax:
clr.l ge_MinWidth(a0)
clr.l ge_MaxWidth(a0)
clr.l ge_MinHeight(a0)
clr.l ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
;fe
;fs "_Selector"
_Selector:
dc.l SGetMinMax
dc.l SLayout
dc.l SRender
dc.l SClick
SGetMinMax:
move.l #GuiScreenWidth,d2
move.l d2,ge_MinWidth(a0)
move.l d2,ge_MaxWidth(a0)
moveq #31,d0
move.l d0,ge_MinHeight(a0)
move.l a0,a1
lea ge_Size(a0),a0
moveq #0,d0
moveq #0,d1
lsr.l #1,d2
.Loop:
addq.l #1,d1
bsr.s _GetMinMax
add.l ge_MinWidth(a0),d0
cmp.l d0,d2
bcs.s .Skronk
move.l ge_Next(a0),a0
tst.l (a0)
beq.s .Done
addq.l #1,d0
bra.s .Loop
.Skronk:
sub.l ge_MinWidth(a0),d0
subq.l #1,d0
subq.l #1,d1
.Done:
sub.l d0,d2
subq.l #1,d1
move.l d1,ge_Temp(a1)
beq.s .SearchLast
divu d1,d2
ext.l d2
addq.l #1,d2
move.l d2,ge_Data(a1)
.SearchLast:
tst.l (a0)
beq.s .AllDone
lea ge_Size(a0),a0
bra.s .SearchLast
.AllDone:
lea ge_Size(a0),a0
move.l a0,ge_Next(a1)
rts
SLayout:
move.l _CurrentDomain(pc),a1
move.l a0,a1
move.l ge_Data(a1),d2
lea ge_Size(a0),a0
moveq #0,d0
move.l ge_Temp(a1),d3
bne.s .PosLoop
move.l #GuiScreenWidth/2,d0
sub.l ge_MinWidth(a0),d0
lsr.l #1,d0
.PosLoop:
move.l d0,ge_Domain+gd_Left(a0)
move.l ge_MinWidth(a0),d1
move.l d1,ge_Domain+gd_Width(a0)
add.l d1,d0
move.l d0,ge_Domain+gd_Right(a0)
move.l ge_MinHeight(a0),d1
move.l d1,ge_Domain+gd_Height(a0)
move.l d1,ge_Domain+gd_Bottom(a0)
clr.l ge_Domain+gd_Top(a0)
add.l d2,d0
bsr _Layout
move.l ge_Next(a0),a0
dbf d3,.PosLoop
rts
SRender:
move.l _CurrentDomain(pc),a1
move.l gd_Top(a1),d0
add.w GuiP(pc),d0
move.w d0,GuiSelP
move.l #GuiLayer1,_GuiL1Ptr
bra _GRender
SClick:
move.l _CurrentDomain(pc),a1
sub.l gd_Top(a1),d1
lea ge_Size(a0),a0
lsr.l #1,d0
.Loop:
cmp2.l ge_Domain+gd_Left(a0),d0
bcs.s .AGrunt
cmp2.l ge_Domain+gd_Top(a0),d1
bcc.s .Bingo
.AGrunt:
move.l ge_Next(a0),a0
tst.l (a0)
bne.s .Loop
rts
.Bingo:
bsr.s _DoClick
rts
;fe
;fs "_Sprite"
_Sprite:
dc.l SprGetMinMax
dc.l 0
dc.l SprRender
dc.l SprClick
SprGetMinMax:
move.l ge_Data(a0),a1
move.l spd_Width(a1),d0
move.l d0,ge_MinWidth(a0)
move.l d0,ge_MaxWidth(a0)
move.l spd_Height(a1),d0
move.l d0,ge_MinHeight(a0)
move.l d0,ge_MaxHeight(a0)
lea ge_Size(a0),a1
move.l a1,ge_Next(a0)
rts
SprRender: ; d6/d7=X,Y a3=SpriteData
move.l ge_Data(a0),a3
move.l _CurrentDomain(pc),a0
move.l gd_Left(a0),d6
move.l gd_Top(a0),d7
move.l d6,d5
and.l #$f,d5
ror.w #4,d5
move.w d5,d0
swap d5
move.w d0,d5
or.l #$0fca0000,d5
lea SprBlit(pc),a0
moveq #0,d0
bsr _GetBlitNode
move.l a1,a0
move.l d5,(a0)+
move.w spd_WWidth+2(a3),d5
addq.w #1,d5
move.w #GuiSelBufferWidth,d1
sub.w d5,d1
sub.w d5,d1
moveq #-2,d2
move.w d2,(a0)+
move.w d1,(a0)+
mulu #GuiSelLineSize,d7
lsr.l #4,d6
add.l d6,d7
add.l d6,d7
add.l _GuiSelBitmap(pc),d7
movem.l spd_Bitmap(a3),d3-4
move.l d4,(a0)+
move.l d3,(a0)+
move.l d7,(a0)+
move.w spd_Height+2(a3),d2
mulu #NbPlanes,d2
move.w d2,(a0)+
move.w d5,(a0)
bsr _AddBlitNode
rts
SprBlit:
move.l (a0)+,bltcon0(a6)
moveq #-1,d0
clr.w d0
move.l d0,bltafwm(a6)
move.w (a0)+,d0
move.w d0,bltamod(a6)
move.w d0,bltbmod(a6)
move.w (a0)+,d0
move.w d0,bltcmod(a6)
move.w d0,bltdmod(a6)
move.l (a0)+,bltapt(a6)
move.l (a0)+,bltbpt(a6)
move.l (a0)+,d0
move.l d0,bltcpt(a6)
move.l d0,bltdpt(a6)
move.w (a0)+,bltsizv(a6)
move.w (a0),bltsizh(a6)
rts
SprClick:
move.l a0,_ActiveGuiEntry
lea SprHandler(pc),a1
move.l a1,_ActiveThingHandler
rts
SprHandler:
btst #6,$bfe001
beq.s .Done
clr.l _ActiveThingHandler
move.l ge_Hook(a0),d0
beq.s .Done
move.l d0,a0
jmp (a0)
.Done:
rts
;fe
;fe
_CurrentDomain:
ds.l 1
_CtGuiTemp:
ds.l 1
;fs "_ClearDomain"
_ClearDomain:
moveq #0,d3
moveq #0,d4
moveq #0,d5
move.l _CurrentDomain(pc),a1
move.l gd_Width(a1),d6
move.l gd_Height(a1),d7
bsr.s _DrawRectangle
rts
;fe
;fs "_DrawBevelBox"
_DrawBevelBox: ; d0/d1/d2/d3=X,Y,W,H d4=RecessedFlag
movem.l d3-d7/a0,-(a7)
move.l d3,a0
moveq #2,d3
tst.b d4
beq.s .Raised
moveq #1,d3
.Raised:
move.l d0,d4
move.l d1,d5
moveq #2,d6
move.l a0,d7
bsr.s _DrawRectangle
eor.b #3,d3
add.l d2,d4
subq.l #2,d4
bsr.s _DrawRectangle
move.l d0,d4
addq.l #1,d4
add.l a0,d5
subq.l #1,d5
move.l d2,d6
subq.l #1,d6
moveq #1,d7
bsr.s _DrawRectangle
eor.b #3,d3
move.l d0,d4
move.l d1,d5
bsr.s _DrawRectangle
movem.l (a7)+,d3-7/a0
rts
;fe
;fs "_DrawRectangle"
_DrawRectangle: ; d4/d5/d6/d7=X,Y,W,H d3=Col
;rts
movem.l d0-7/a0-6,-(a7)
move.l _CurrentDomain(pc),a0
add.l gd_Left(a0),d4
add.l gd_Top(a0),d5
add.l #2,_RectCount
lea _RectBlit,a0
moveq #0,d0
bsr _GetBlitNode
move.l a1,a2
lea _RectBlit,a0
moveq #0,d0
bsr _GetBlitNode
move.l a1,a0
move.l a2,a3
move.l #$050c0000,d0
move.l d0,d1
move.l #$05fc0000,d2
btst #0,d3
beq.s .Bp1Ok
move.l d2,d0
.Bp1Ok:
move.l d0,(a0)+
btst #1,d3
beq.s .Bp2Ok
move.l d2,d1
.Bp2Ok:
move.l d1,(a3)+
move.l d4,d0
lsr.l #4,d4
and.b #$f,d0
extb.l d0
add.l d0,d6
moveq #-1,d1
lsr.w d0,d1
move.w d1,(a0)+
move.w d1,(a3)+
move.l d6,d0
lsr.l #4,d6
moveq #-1,d1
and.b #$f,d0
beq.s .Gaaa
addq.l #1,d6
lsr.w d0,d1
not.w d1
.Gaaa:
move.w d1,(a0)+
move.w d1,(a3)+
move.l _GuiBitmap(pc),d0
add.l d4,d0
add.l d4,d0
move.l d5,d1
move.l #GuiLineSize,d2
mulu d2,d1
add.l d1,d0
move.l d0,(a0)+
add.l #GuiBufferWidth,d0
move.l d0,(a3)+
sub.l d6,d2
sub.l d6,d2
move.w d2,(a0)+
move.w d2,(a3)+
move.w d7,(a0)+
move.w d7,(a3)+
move.w d6,(a0)
move.w d6,(a3)
bsr _PreAddBlitNode
move.l a2,a1
bsr _AddBlitNode
movem.l (a7)+,d0-7/a0-6
rts
_RectBlit:
lea _RectHook(pc),a5
move.l a5,_BlitHook
move.l (a0)+,bltcon0(a6)
move.l (a0)+,bltafwm(a6)
move.l (a0)+,d0
move.l d0,bltbpt(a6)
move.l d0,bltdpt(a6)
move.w (a0)+,d0
move.w d0,bltbmod(a6)
move.w d0,bltdmod(a6)
move.w #-1,bltadat(a6)
move.w (a0)+,bltsizv(a6)
move.w (a0),bltsizh(a6)
rts
_RectHook:
sub.l #1,_RectCount
rts
_RectCount:
dc.l 0
;fe
;fs "_DrawText"
_TextLimit:
dc.l 0
_DrawText: ; d6/d7=X,Y d5=Length d4=Col a5=String
movem.l d3/d5-6/a0/a5,-(a7)
tst.l d5
bne.s .LengthOk
move.l a5,a0
.StrLen:
tst.b (a0)+
bne.s .StrLen
sub.l a5,a0
move.l a0,d5
subq.l #1,d5
.LengthOk:
move.l _TextLimit(pc),d3
beq.s .NoClip
sub.l d6,d3
lsr.l #3,d3
cmp.l d5,d3
bcc.s .NoClip
move.l d3,d5
.NoClip:
subq.l #1,d5
move.l d5,d3
.Loop:
move.b (a5)+,d5
bsr.s _DrawChar
addq.l #8,d6
dbf d3,.Loop
movem.l (a7)+,d3/d5-6/a0/a5
rts
;fe
;fs "_DrawChar"
_DrawChar: ; d6/d7=X,Y d5=Char d4=Col
;rts
movem.l d0-3/d6-7/a0-2,-(a7)
move.l _CurrentDomain(pc),a0
add.l gd_Left(a0),d6
add.l gd_Top(a0),d7
cmp.b #$a0,d5
beq.s .Done
bcs.s .Ok
cmp.b #$ad,d5
bcs.s .Pfouh
beq.s .Crévindiou
subq.b #1,d5
bra.s .Pfouh
.Crévindiou:
move.b #"-",d5
bra.s .Ok
.Pfouh:
subq.b #1,d5
.Ok:
move.l _GuiBitmap(pc),a1
mulu #GuiLineSize,d7
add.l d7,a1
moveq #0,d7
not.b d7
ror.l #8,d7
btst #0,d5
beq.s .EvenChar
subq.l #2,a1
addq.l #8,d6
lsr.l #8,d7
.EvenChar:
lea _GuiFont(pc),a0
and.b #$fe,d5
add.l d5,a0
move.l d6,d0
lsr.l #3,d0
and.b #$fe,d0
add.l d0,a1
and.l #$f,d6
move.l #254,d0
move.l #GuiBufferWidth,d1
moveq #7,d3
.RWait:
tst.l _RectCount
bne.s .RWait
lea CharTable(pc),a2
jsr (a2,d4.w*2)
.Done:
movem.l (a7)+,d0-3/d6-7/a0-2
rts
CharTable:
bra.s CharLoop0
bra.s CharLoop1
bra.s CharLoop2
bra.s CharLoop3
CharLoop0:
move.l (a0),d2
and.l d7,d2
lsr.l d6,d2
not.l d2
and.l d2,(a1)
add.l d1,a1
and.l d2,(a1)
add.l d1,a1
add.l d0,a0
dbf d3,CharLoop0
rts
CharLoop1:
move.l (a0),d2
and.l d7,d2
lsr.l d6,d2
or.l d2,(a1)
not.l d2
add.l d1,a1
and.l d2,(a1)
add.l d1,a1
add.l d0,a0
dbf d3,CharLoop1
rts
CharLoop2:
move.l (a0),d2
and.l d7,d2
lsr.l d6,d2
not.l d2
and.l d2,(a1)
not.l d2
add.l d1,a1
or.l d2,(a1)
add.l d1,a1
add.l d0,a0
dbf d3,CharLoop2
rts
CharLoop3:
move.l (a0),d2
and.l d7,d2
lsr.l d6,d2
or.l d2,(a1)
add.l d1,a1
or.l d2,(a1)
add.l d1,a1
add.l d0,a0
dbf d3,CharLoop3
rts
;fe
;fs "Font"
_GuiFont:
incbin "GuiFont.bin"
;fe